<template>
	<view>
		<my-loading :vshow="loadingshow"></my-loading>
		<u-top-tips ref="uTips" :navbar-height="windowtop+50"></u-top-tips>
		<!-- 我要开店 -->
		<div v-if="id==0">
			<div class="openshop">
				<div class="openshop-head">
					<u-steps :list="numList" :current="id" :un-active-color="imgdata.color" active-color="green"
						type="success" mode="number"></u-steps>
				</div>
				<div class="openshop-img">
					<image :src="cnds+'/upload/ad/'+imgdata.img" mode="widthFix" style="width: 100%;"></image>
				</div>
			</div>
			<div class="openshili" v-for="(data,index) in shili" :key="index">
				<div class="openshili_left">
					<image :src="cnds+'/images/'+data.img" style="width: 100%;height: 100%;"></image>
				</div>
				<div class="openshili_right">
					<div class="title">{{index+1}}.{{data.name}}</div>
					<div class="xiangxi">{{data.xiangxi}}</div>
				</div>
			</div>

			<div class="opensubmit">
				<div class="opensubmit_top">
					<div class="tongyi">
						<u-radio-group v-model="value">
							<u-radio shape="circle" active-color="green">我已阅读并同意</u-radio>
						</u-radio-group>
					</div>
					<navigator url="../content/content?name=聚优先开店说明" hover-class="none" class="tongname">《聚优先开店说明》
					</navigator>
				</div>
				<div class="opensubmit_bot" @click="substr(0)">我准备好了(开店起航)</div>
			</div>
		</div>
		<!-- 准备资料 -->
		<div v-if="id==1">
			<div class="openshop" style="background-color: white;height: 300rpx;overflow: hidden;">
				<div class="openshop-head">
					<u-steps :list="numList" :current="id" :un-active-color="imgdata.color" active-color="green"
						type="success" mode="number"></u-steps>
				</div>
				<div class="openshop-img" style="height: 100rpx;">
					<image :src="cnds+'/upload/ad/'+imgdata.img" :mode="'top'" style="width: 100%;height: 300rpx;">
					</image>
				</div>
			</div>

			<view class="grace-idcard-main">
				<view class="grace-idcard-itemstop">
					<u-form :model="form" ref="uForm">
						<u-form-item label-width="150" label="申请人姓名" prop="sqname">
							<u-input v-model="form.sqname" />
						</u-form-item>
						<u-form-item label-width="150" label="身份证号码" prop="sqnumber">
							<u-input v-model="form.sqnumber" />
						</u-form-item>
					</u-form>
				</view>
				<view class="grace-idcard-text">
					身份证照片 ( 正面 )
				</view>
				<view class="grace-idcard-items">
					<view class="grace-idcard-uper-btn" @tap="selectImg1">
						<view class="img">
							<image :src="cnds+'/images/camera.png'" mode="widthFix" />
						</view>
						<view class="text">拍摄或选择照片</view>
					</view>
					<view class="grace-idcard-preview">
						<image :src="idCard1" @tap="previewImg1" :mode="'aspectFill'"></image>
					</view>
				</view>
				<view class="grace-idcard-text">
					身份证照片 ( 背面 )
				</view>
				<view class="grace-idcard-items">
					<view class="grace-idcard-uper-btn" @tap="selectImg2">
						<view class="img">
							<image :src="cnds+'/images/camera.png'" mode="widthFix" />
						</view>
						<view class="text">拍摄或选择照片</view>
					</view>
					<view class="grace-idcard-preview">
						<image :src="idCard2" @tap="previewImg2" :mode=" 'aspectFill'"></image>
					</view>
				</view>


				<view class="grace-idcard-text">
					营业执照
				</view>
				<view class="grace-idcard-items3">
					<view class="grace-idcard-uper-btn" @tap="selectImg3">
						<view class="img">
							<image :src="cnds+'/images/camera.png'" mode="widthFix" />
						</view>
						<view class="text">拍摄或选择照片</view>
					</view>
					<view class="grace-idcard-preview">
						<image :src="idCard3" @tap="previewImg3" :mode=" 'aspectFill'"></image>
					</view>
				</view>
				<div class="opensubmit2">
					<div class="opensubmit_top">
						<div class="tongyi">
							<u-radio-group v-model="value">
								<u-radio shape="circle" active-color="green">我已阅读并同意</u-radio>
							</u-radio-group>
						</div>
						<navigator url="../content/content?name=聚优先上传资料协议" hover-class="none" class="tongname">
							《聚优先上传资料协议》</navigator>
					</div>
					<div class="opensubmit_bot" @click="substr(1)">上传提交审核</div>
				</div>
			</view>
		</div>
		<!-- 等待审核 -->
		<div v-if="id==2">
			<div class="openshop" style="background-color: white;height: 300rpx;overflow: hidden;">
				<div class="openshop-head">
					<u-steps :list="numList" :current="id" :un-active-color="imgdata.color"
						:active-color="Auditfailure?'red':'green'" type="success" mode="number"></u-steps>
				</div>
				<div class="openshop-img" style="height: 100rpx;">
					<image :src="cnds+'/upload/ad/'+imgdata.img" :mode="'top'" style="width: 100%;height: 300rpx;">
					</image>
				</div>
			</div>


			<view class="grace-idcard-main2">
				<view class="grace-idcard-itemstop">
					<u-form :model="form" ref="uForm">
						<u-form-item label-width="150" label="申请人姓名" prop="sqname">
							<u-input v-model="form.sqname" disabled />
						</u-form-item>
						<u-form-item label-width="150" label="身份证号码" prop="sqnumber">
							<u-input v-model="form.sqnumber" disabled />
						</u-form-item>
					</u-form>
				</view>
				<view class="grace-idcard-text">
					身份证照片 ( 正面 )
				</view>
				<view class="grace-idcard-items">
					<image :src="idCard1" @tap="previewImg1" :mode=" 'widthFix'" style="width: 100%;"></image>

				</view>
				<view class="grace-idcard-text">
					身份证照片 ( 背面 )
				</view>
				<view class="grace-idcard-items">
					<image :src="idCard2" @tap="previewImg2" :mode=" 'widthFix'" style="width: 100%;"></image>

				</view>


				<view class="grace-idcard-text">
					营业执照
				</view>
				<view class="grace-idcard-items3">
					<image :src="idCard3" @tap="previewImg3" :mode=" 'widthFix'" style="width: 100%;"></image>
				</view>
				<view class="grace-idcard-text" v-if="Auditfailure" style="color:red;">
					失败原因
				</view>
				<div class="auditfailurevalue" v-if="Auditfailure">
					{{AuditfailureValue}}
				</div>
				<div style="height: 160rpx;"></div>
				<div class="opensubmit3">
					<!-- <div v-if="!Auditfailure" class="opensubmit_top" @click="substr(2)">撤销审核</div> -->
					<div v-if="!Auditfailure" class="opensubmit_bot">{{Audit}}</div>
					<div v-if="Auditfailure" class="opensubmit_top" @click="failure">审核失败</div>
					<div v-if="Auditfailure" class="opensubmit_bot" @click="again">重新申请</div>
				</div>
			</view>
		</div>
		<!-- 审核通过 -->
		<div v-if="id==3">
			<div class="openshop" style="background-color: white;height: 300rpx;overflow: hidden;">
				<div class="openshop-head">
					<u-steps :list="numList" :current="id" :un-active-color="imgdata.color" active-color="green"
						type="success" mode="number"></u-steps>
				</div>
				<div class="openshop-img" style="height: 100rpx;">
					<image :src="cnds+'/upload/ad/'+imgdata.img" :mode="'top'" style="width: 100%;height: 300rpx;">
					</image>
				</div>
			</div>
			<div class="title">
				<u-notice-bar mode="horizontal" type="primary" :list="['您的审核已通过，请填写完善下列信息，即将完成开店！']"></u-notice-bar>
			</div>
			<div class="box">
				<!-- <div class="boxbox" v-for="(valuedata,index) in data" :key="index">
					<div class="boxleft">{{valuedata.name}}</div>
					<div class="boxright">
						<input v-model="valuedata.value" type="text"  :placeholder="valuedata.plname"></input>
					</div>
				</div> -->
				<u-form :model="form" ref="uForm">
					<u-form-item label-width="150" label="申请人姓名" prop="sqname">
						<u-input v-model="form.sqname" disabled />
					</u-form-item>
					<u-form-item label-width="150" label="身份证号码" prop="sqnumber">
						<u-input v-model="form.sqnumber" disabled />
					</u-form-item>
					<u-form-item label-width="150" label="店铺名称" prop="name">
						<u-input v-model="form.name" />
					</u-form-item>
					<u-form-item label-width="150" label="LOGO" prop="logo">
						<u-upload ref="uUpload" max-count="1" :action="form.action" :auto-upload="false"
							@on-choose-complete="onchoosecomplete"></u-upload>
					</u-form-item>
					<u-form-item label="地区" prop="address">
						<u-input v-model="form.address" type="select" @click="form.show = true" />
						<u-picker mode="region" v-model="form.show"
							:area-code='[form.addressobj.province.value, form.addressobj.city.value,form.addressobj.area.value]'
							@confirm="addressconfirm"></u-picker>
					</u-form-item>
					<u-form-item label-width="150" label="详细地址" prop="addressx">
						<u-input v-model="form.addressx" />
					</u-form-item>
					<u-form-item label-width="200" label="店铺的经纬度" prop="longlat">
						<u-input v-model="form.longlat" />
						<u-icon name="map" size="40" @click="dingwei"></u-icon>
					</u-form-item>
					<u-form-item label-width="150" label="服务热线" prop="phone">
						<u-input v-model="form.phone" />
					</u-form-item>
				</u-form>
			</div>
			<div class="opensubmit2">
				<div class="opensubmit_top">
					<div class="tongyi">
						<u-radio-group v-model="value">
							<u-radio shape="circle" active-color="green">我已阅读并同意</u-radio>
						</u-radio-group>
					</div>
					<navigator url="../content/content?name=聚优先上传资料协议" hover-class="none" class="tongname">《聚优先上传资料协议》
					</navigator>
				</div>
				<div class="opensubmit_bot" @click="substr(3)">保存店铺信息</div>
			</div>
		</div>
		<!-- 开店已完成 -->
		<div v-if="id==4">
			<div class="title" :style="{'margin-top':windowtop+'px'}">
				<u-notice-bar mode="horizontal" type="primary" :list="['您的店铺可以运营了，如需修改下列信息请前往后台，谢谢！']"></u-notice-bar>
			</div>
			<div class="box">
				<!-- <div class="boxbox" v-for="(valuedata,index) in data" :key="index">
					<div class="boxleft">{{valuedata.name}}</div>
					<div class="boxright">
						<input v-model="valuedata.value" type="text"  :placeholder="valuedata.plname"></input>
					</div>
				</div> -->
				<u-form :model="form" ref="uForm">

					<u-form-item label-width="150" label="商铺账户" prop="user">
						<u-input v-model="form.user" disabled />
					</u-form-item>
					<u-form-item label-width="150" label="商铺密码" prop="pwd">
						<u-input v-model="form.pwd" disabled />
					</u-form-item>
					<u-form-item label-width="200" label="商铺管理地址" prop="url">
						<u-input v-model="form.url" />
					</u-form-item>
					<u-form-item label-width="150" label="姓名" prop="sqname">
						<u-input v-model="form.sqname" disabled />
					</u-form-item>
					<u-form-item label-width="150" label="身份证号" prop="sqnumber">
						<u-input v-model="form.sqnumber" disabled />
					</u-form-item>
					<u-form-item label-width="150" label="店铺名称" prop="name">
						<u-input v-model="form.name" disabled />
					</u-form-item>
					<u-form-item label-width="150" label="LOGO" prop="logo">
						<u-image @tap="logoimg" width="100rpx" height="100rpx" shape="circle"
							:src="form.logo"></u-image>
					</u-form-item>
					<u-form-item label="地区" prop="address">
						<u-input v-model="form.address" type="select" @click="form.show = true" />
						<u-picker mode="region" v-model="form.show"
							:area-code='[form.addressobj.province.value, form.addressobj.city.value,form.addressobj.area.value]'
							@confirm="addressconfirm"></u-picker>
					</u-form-item>
					<u-form-item label-width="150" label="详细地址" prop="addressx">
						<u-input v-model="form.addressx" disabled />
					</u-form-item>
					<u-form-item label-width="200" label="店铺的经纬度" prop="longlat">
						<u-input v-model="form.longlat" disabled />
						<!-- <u-icon name="map" size="40" @click="dingwei"></u-icon> -->
					</u-form-item>
					<u-form-item label-width="150" label="服务热线" prop="phone">
						<u-input v-model="form.phone" disabled />
					</u-form-item>
				</u-form>
			</div>


			<view class="grace-idcard-main2">

				<view class="grace-idcard-text">
					身份证照片 ( 正面 )
				</view>
				<view class="grace-idcard-items">
					<image :src="idCard1" @tap="previewImg1" :mode=" 'widthFix'" style="width: 100%;"></image>

				</view>
				<view class="grace-idcard-text">
					身份证照片 ( 背面 )
				</view>
				<view class="grace-idcard-items">
					<image :src="idCard2" @tap="previewImg2" :mode=" 'widthFix'" style="width: 100%;"></image>

				</view>


				<view class="grace-idcard-text">
					营业执照
				</view>
				<view class="grace-idcard-items3">
					<image :src="idCard3" @tap="previewImg3" :mode=" 'widthFix'" style="width: 100%;"></image>
				</view>
			</view>

		</div>
	</view>
</template>

<script>
	var user = uni.getStorageSync('user');
	var user_key = uni.getStorageSync('user_key');
	var yhpz = uni.getStorageSync('yhpz');
	export default {
		data() {
			return {
				windowtop: 0,
				windownav: 0,
				idCard1: '',
				idCard2: '',
				idCard3: '',
				id: 0,
				loadingshow: true,
				value: 'true',
				form: {
					sqname: '',
					sqnumber: '',
					url: 'https://plshop.sdsj88.cn/admin/login.php',
					user: '',
					pwd: '初始密码与您当前账户的密码同步',
					name: '', //店铺名称
					logo: '', //logo
					action: 'http://www.sdsj88.com/', //logo上传地址
					show: false,
					address: '', //地区
					addressarr: '',
					addressobj: {
						"province": {
							"label": "北京市",
							"value": "11"
						},
						"city": {
							"label": "市辖区",
							"value": "1101"
						},
						"area": {
							"label": "东城区",
							"value": "110101"
						}
					},
					addressx: '', //详细地址
					longlat: '', //经纬度
					phone: '', //服务热线

				},
				rules: {
					sqname: [{
						required: true,
						message: '请输入姓名',
						// blur和change事件触发检验
						trigger: ['blur', 'change'],
					}, {
						pattern: /^[\u4e00-\u9fa5\a-zA-Z]*$/g,
						// 正则检验前先将值转为字符串
						transform(value) {
							return String(value);
						},
						trigger: ['blur', 'change'],
						message: '只能中文或英文'
					}, ],
					sqnumber: [{
						required: true,
						message: '请输入身份证号码',
						// blur和change事件触发检验
						trigger: ['blur', 'change'],
					}, {
						pattern: /^[\d\a-zA-Z]*$/g,
						// 正则检验前先将值转为字符串
						transform(value) {
							return String(value);
						},
						trigger: ['blur', 'change'],
						message: '只能数字或英文'
					}, ],
					name: [{
							required: true,
							message: '请输入店铺名称',
							// blur和change事件触发检验
							trigger: ['blur', 'change'],
						},
						// 正则判断为字母或数字
						{
							pattern: /^[\u4e00-\u9fa5\0-9a-zA-Z]*$/g,
							// 正则检验前先将值转为字符串
							transform(value) {
								return String(value);
							},
							trigger: ['blur', 'change'],
							message: '只能是字母或数字或中文'
						},
						// 6-8个字符之间的判断
						{
							min: 3,
							max: 8,
							trigger: ['blur', 'change'],
							message: '长度在3-8个字符之间'
						},
						// // 自定义规则判断是否包含字母"A"
						// {
						// 	validator: (rule, value, callback) => {
						// 		return this.$u.test.contains(value, "A");
						// 	},
						// 	message: '必须包含字母"A"'
						// },
						// 校验用户是否已存在
						{
							asyncValidator: (rule, value, callback) => {
								uni.request({
									url: uni.getStorageSync('APP_key') + '/openshop_data.php',
									method: 'POST',
									data: {
										user: user,
										user_key: user_key,
										yhpz: yhpz,
										type: 'chaname',
										name: value,

									},
									header: {
										'content-type': 'application/x-www-form-urlencoded'
									},
									dataType: 'json',
									success: (res) => {
										if (res.data.id != 2) {
											callback(new Error('该商铺名称已被使用'));
										} else {
											// 如果校验通过，也要执行callback()回调
											callback();
										}
									}
								});

							},
							// 如果是异步校验，无需写message属性，错误的信息通过Error抛出即可
							// message: 'xxx'
						}
					],
					logo: [{
						required: true,
						message: '请上传logo',
						// blur和change事件触发检验
						trigger: ['change'],
					}],
					address: [{
						required: true,
						message: '请选择地区',
						// blur和change事件触发检验
						trigger: ['change'],
					}],
					addressx: [{
						required: true,
						message: '请填写详细地址',
						// blur和change事件触发检验
						trigger: ['blur', 'change'],
					}, {
						pattern: /^[\u4e00-\u9fa5\0-9a-zA-Z\(\)]*$/g,
						// 正则检验前先将值转为字符串
						transform(value) {
							return String(value);
						},
						trigger: ['blur', 'change'],
						message: '只能数字或字母或中文或英文括号'
					}, ],
					longlat: [{
						required: true,
						message: '请获取您的位置',
						// blur和change事件触发检验
						trigger: ['change'],
					}, {
						pattern: /^[\0-9\,\.]*$/g,
						// 正则检验前先将值转为字符串
						transform(value) {
							return String(value);
						},
						trigger: ['blur', 'change'],
						message: '只能数字或逗号或点'
					}, ],
					phone: [{
							required: true,
							message: '请输入您的服务热线',
							// blur和change事件触发检验
							trigger: ['blur', 'change'],
						},
						{
							max: 13,
							message: '最大不能大于13个字符',
							trigger: ['blur', 'change'],
						}, {
							pattern: /^[\0-9\-]*$/g,
							// 正则检验前先将值转为字符串
							transform(value) {
								return String(value);
							},
							trigger: ['blur', 'change'],
							message: '只能数字或中杆字符'
						},
					]
				},
				numList: [{
					name: '我要开店'
				}, {
					name: '准备资料'
				}, {
					name: '等待审核'
				}, {
					name: '审核通过'
				}, {
					name: '开店完成'
				}, ],
				shili: [{
					name: "身份证",
					xiangxi: '需要提供营业执照人的正反面身份证',
					img: 'idcard1.png',
				}, {
					name: "营业执照",
					xiangxi: '需要提供有效期内营业执照，或其他监管部门认可的具有营业执照同等法律的有效证件',
					img: 'yingyezhizhao.jpg',
				}],
				imgdata: '',
				cnds: '',
				Audit: '等待审核',
				Auditfailure: false, //审核失败
				AuditfailureValue: '', //审核失败内容
			}
		},
		onReady() {
			uni.getSystemInfo({
				success: (res) => {
					this.windowtop = parseInt(res.statusBarHeight);
				}
			});
			if (this.id == 3 || this.id == 1) {
				this.$refs.uForm.setRules(this.rules);
			}

		},
		onLoad(option) {
			this.id = option.id;
			if (this.id == 4) {
				uni.setNavigationBarTitle({
					title: '店铺信息资质',
				})
			} else {
				uni.setNavigationBarTitle({
					title: this.numList[this.id].name,
				})
			}
			this.cnds = uni.getStorageSync('CND_key');
			this.idCard1 = this.cnds + '/images/idcard1.png',
				this.idCard2 = this.cnds + '/images/idcard2.png',
				this.idCard3 = this.cnds + '/images/yingyezhizhao.jpg',
				uni.request({
					url: uni.getStorageSync('APP_key') + '/ad.php',
					method: 'POST',
					data: {
						name: '记账本背景',

					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
					},
					dataType: 'json',
					success: (res) => {
						let arr = [];
						res.data.forEach((item, inds) => {
							if (item.title == '我要开店') {
								this.imgdata = item;
							}
						});



					}
				});
		},
		mounted() {
			setTimeout(() => {
				this.loadingshow = false;
			}, 500);
			if (this.id != 1) {
				this.storedata();
			}
		},
		methods: {
			logoimg: function() {
				uni.previewImage({
					urls: [this.form.logo],
					// longPressActions: {
					//     itemList: ['发送给朋友', '保存图片', '收藏'],
					//     success: function(data) {
					//         console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
					//     },
					//     fail: function(err) {
					//         console.log(err.errMsg);
					//     }
					// }
				});
			},
			storedata: function() {
				uni.request({
					url: uni.getStorageSync('APP_key') + '/openshop_data.php',
					method: 'POST',
					data: {
						user: user,
						user_key: user_key,
						yhpz: yhpz,
						type: 'storedata',

					},
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					dataType: 'json',
					success: (res) => {
						this.idCard1 = this.cnds + '/upload/store/card1/' + res.data.cid1;
						this.idCard2 = this.cnds + '/upload/store/card2/' + res.data.cid2;
						this.idCard3 = this.cnds + '/upload/store/license/' + res.data.license;
						this.form.sqname = res.data.name;
						this.form.sqnumber = res.data.idnumber;
						if (res.data.start == 1) {
							uni.setNavigationBarTitle({
								title: '审核失败',
							})
							this.numList[2].name = '审核失败';
							this.Auditfailure = true;
							this.AuditfailureValue = res.data.message;
							this.form.sqname = res.data.name;
							this.form.sqnumber = res.data.idnumber;
						}
						if (res.data.start == 7) {
							this.Audit = '审核中';
						}
						if (res.data.start == 2) {
							this.Auditfailure = false;
							this.AuditfailureValue = '';
						}
						if (res.data.start == 4) {
							this.idCard1 = this.cnds + '/upload/store/card1/' + res.data.cid1;
							this.idCard2 = this.cnds + '/upload/store/card2/' + res.data.cid2;
							this.idCard3 = this.cnds + '/upload/store/license/' + res.data.license;
							this.form.sqname = res.data.name;
							this.form.sqnumber = res.data.idnumber;
							this.form.name = res.data.storename;
							this.form.phone = res.data.phone;
							this.form.longlat = res.data.longlat;
							this.form.address = (res.data.address.split('@'))[0] + (res.data.address.split(
								'@'))[1] + (res.data.address.split('@'))[2];
							this.form.addressx = res.data.addressx;
							this.form.logo = this.cnds + '/upload/store/logo/' + res.data.logo;
							this.form.user = res.data.uid + '@' + res.data.uid;

						}
						if (res.data.start == 3) {
							this.form.sqname = res.data.name;
							this.form.sqnumber = res.data.idnumber;

						}

					}
				});
			},
			failure: function() { //审核失败
				uni.pageScrollTo({
					scrollTop: 99999999,
					duration: 300
				});
			},
			again: function() { //重新申请
				uni.setNavigationBarTitle({
					title: '我要开店',
				})
				this.numList[2].name = '等待审核';
				this.form.sqname = '';
				this.form.sqnumber = '';
				this.idCard1 = this.cnds + '/images/idcard1.png',
					this.idCard2 = this.cnds + '/images/idcard2.png',
					this.idCard3 = this.cnds + '/images/yingyezhizhao.jpg',
					this.id = 0;
				this.value = 'true';
			},
			dingwei: function() { //定位
				uni.getLocation({
					type: 'wgs84',
					success: (res) => {
						this.form.longlat = res.longitude.toFixed(8) + ',' + res.latitude.toFixed(8);
					}
				});
			},
			onchoosecomplete: function(e) { //选择图片触发
				this.form.logo = e[0].url;
			},
			addressconfirm: function(e) { //选择地区点击确认回调
				this.form.addressobj = e;
				this.form.address = e.province.label + e.city.label + e.area.label;
				this.form.addressarr = e.province.label + "@" + e.city.label + '@' + e.area.label;

			},
			substr: function(id) { //审核通过提交店铺信息
				if (id == 0) { //开始开店
					if (this.value == 'true') {
						this.$refs.uTips.show({
							title: '请阅读后,同意方可开店',
							type: 'error',
							duration: '1800'
						})
						return;
					}
					this.id = 1;
					this.value = 'true';
				} else if (id == 1) { //提交审核
					this.$refs.uForm.setRules(this.rules);
					this.$refs.uForm.validate(valid => {
						if (valid) {
							if (this.value == 'true') {
								this.$refs.uTips.show({
									title: '请阅读后,同意方可提交',
									type: 'error',
									duration: '1800'
								})
								return;
							}
							if (this.idCard1 == this.cnds + '/images/idcard1.png' || this.idCard2 == this
								.cnds + '/images/idcard2.png' || this.idCard3 == this.cnds +
								'/images/yingyezhizhao.jpg') {
								uni.showToast({
									title: "还有证件未拍照",
									icon: "none"
								});
								return;
							}
							uni.showLoading({
								title: "提交中"
							});
							//#ifndef MP-WEIXIN
							uni.uploadFile({
								url: uni.getStorageSync('APP_key') +
								'/openshop_data.php', //仅为示例，非真实的接口地址
								files: [{
									name: 'card1',
									uri: this.idCard1,
								}, {
									name: 'card2',
									uri: this.idCard2,
								}, {
									name: 'license',
									uri: this.idCard3,
								}],
								formData: {
									'user': user,
									'user_key': user_key,
									'yhpz': yhpz,
									'type': 'setdata',
									'name': this.form.sqname,
									'number': this.form.sqnumber,
								},
								success: (uploadFileRes) => {
									var data = JSON.parse(uploadFileRes.data);
									uni.hideLoading();
									if (data.id == 2) {
										uni.showToast({
											title: "成功申请！",

										});
										this.storedata();
										this.id = 2;
										this.value = 'true';
									} else {
										uni.showToast({
											title: "提交数据有误！,请检查或重试！",
											icon: "none",

										});
									}

								},
								fail() {
									uni.hideLoading();
									uni.showToast({
										title: "提交失败！,请重试！",
										icon: "none"
									});
								}
							});
							//#endif

						} else {
							console.log('验证失败');
						}
					});

				} else if (id == 2) { //撤销审核
					uni.showModal({
						title: '撤销开店申请',
						content: '您确定要撤销申请？',
						success: (res) => {
							if (res.confirm) {
								uni.request({
									url: uni.getStorageSync('APP_key') + '/openshop_data.php',
									method: 'POST',
									data: {
										user: user,
										user_key: user_key,
										yhpz: yhpz,
										type: 'undo',

									},
									header: {
										'content-type': 'application/x-www-form-urlencoded'
									},
									dataType: 'json',
									success: (res) => {
										if (res.data.id == 2) {
											uni.showToast({
												title: "撤销成功！",

											});
											this.id = 0;
											this.value = 'true';
										} else {
											uni.showToast({
												title: "撤销失败！,请检查或重试！",
												icon: "none",

											});
										}
									},
									fail: () => {
										uni.showToast({
											title: "撤销失败！,请检查或重试！",
											icon: "none",

										});
									}
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});

				} else if (id == 3) { //保存开店完成信息
					if (this.value == 'true') {
						this.$refs.uTips.show({
							title: '请阅读后,同意方可提交',
							type: 'error',
							duration: '1800'
						})
						return;
					}
					this.$refs.uForm.validate(valid => {
						if (valid) {
							uni.uploadFile({
								url: uni.getStorageSync('APP_key') +
								'/openshop_data.php', //仅为示例，非真实的接口地址
								filePath: this.form.logo,
								name: 'file',
								formData: {
									'user': user,
									'user_key': user_key,
									'yhpz': yhpz,
									'type': 'setstoredata',
									name: this.form.name,
									address: this.form.addressarr,
									addressx: this.form.addressx,
									phone: this.form.phone,
									longlat: this.form.longlat,
								},
								success: (uploadFileRes) => {
									var data = JSON.parse(uploadFileRes.data);
									if (data.id == 2) {
										uni.showToast({
											title: "开店成功！",

										});
										this.storedata();
										this.id = 4;
										this.value = 'true';
									} else {
										uni.showToast({
											title: "提交数据有误！,请检查或重试！",
											icon: "none",

										});
									}
								}
							});
						} else {
							console.log('验证失败');
						}
					});
				}
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 300
				});
			},
			selectImg1: function() {
				uni.chooseImage({
					count: 1,
					success: (res) => {
						this.idCard1 = res.tempFilePaths[0];
					}
				})
			},
			selectImg2: function() {
				uni.chooseImage({
					count: 1,
					success: (res) => {
						this.idCard2 = res.tempFilePaths[0];
					}
				})
			},
			previewImg1: function() {
				uni.previewImage({
					urls: [this.idCard1]
				});
			},
			previewImg2: function() {
				uni.previewImage({
					urls: [this.idCard2]
				});
			},
			selectImg3: function() {
				uni.chooseImage({
					count: 1,
					success: (res) => {
						this.idCard3 = res.tempFilePaths[0];
					}
				})
			},
			previewImg3: function() {
				uni.previewImage({
					urls: [this.idCard3]
				});
			},
			uploadCards: function() {
				if (this.idCard1 == this.cnds + '/images/idcard1.png' || this.idCard2 == this.cnds +
					'/images/idcard2.png' || this.idCard3 == this.cnds + '/images/yingyezhizhao.jpg') {
					uni.showToast({
						title: "还有证件未拍照",
						icon: "none"
					});
					return;
				}
				// 因底层限制一次上传一个
				uni.showLoading({
					title: "提交中"
				});
				// 上传正面
				/* var uploadTask1 = uni.uploadFile({
					url: 'https://unidemo.dcloud.net.cn/upload',
					filePath: this.idCard1,
					fileType: 'image',
					name: 'data',
					success: (uploadFileRes) => {
						// 上传成功后返回服务器端保存的路径
						console.log(uploadFileRes.data);
						// 上传背面
						var uploadTask2 = uni.uploadFile({
							url: 'https://unidemo.dcloud.net.cn/upload',
							filePath: this.idCard2,
							fileType: 'image',
							name: 'data',
							success: function(uploadFileRes) {
								// 上传成功后返回服务器端保存的路径
								console.log(uploadFileRes.data);
								// 至此2张照片上传完毕
								uni.hideLoading();
							}
						});
					}
				}); */
			}
		}
	}
</script>

<style lang="scss">
	.openshop {
		width: 750rpx;
		position: relative;

		.openshop-head {
			width: 750rpx;
			height: 100rpx;
			position: absolute;
			left: 0px;
			top: 160rpx;
			z-index: 2;
		}

		.openshop-img {
			width: 750rpx;
		}
	}

	.openshili {
		height: 250rpx;
		padding: 20rpx;
		background-color: $bgcolor-white-0;
		display: flex;
		justify-content: center;
		align-items: center;

		.openshili_left {
			width: 300rpx;
			height: 200rpx;
			margin-right: 40rpx;
		}

		.openshili_right {
			width: 300rpx;
			height: 200rpx;

			.title {
				font-weight: 600;
				font-size: $color-size-5;
			}

			.xiangxi {
				font-weight: 600;
				font-size: $color-size-1;
				color: $color-black-4;
			}
		}
	}

	.opensubmit {
		height: 160rpx;
		padding: 20rpx;
		background-color: $bgcolor-white-0;

		.opensubmit_top {
			height: 80rpx;
			display: flex;
			flex-wrap: nowrap;
			align-items: center;

			.tongyi {}

			.tongname {
				color: $color-orange-4;
			}
		}

		.opensubmit_bot {
			height: 80rpx;
			border-radius: 100rpx;
			background-color: $bgcolor-orange-2;
			color: $color-white-0;
			font-size: $color-size-5;
			text-align: center;
			line-height: 80rpx;
		}
	}



	.grace-idcard-main {
		margin: 20upx 30upx;

		.grace-idcard-text {
			line-height: 2em;
			margin-top: 30upx;
		}

		.grace-idcard-itemstop {
			background: #FFFFFF;
			border-radius: 30upx;
			padding: 20rpx;
		}

		.grace-idcard-items {
			height: 300rpx;
			background: #FFFFFF;
			border-radius: 30upx;
			display: flex;
			align-items: center;
			justify-content: center;

			.grace-idcard-uper-btn {
				width: 276upx;
				background: #F1F1F1;
				border-radius: 10upx;
				text-align: center;
				margin-right: 10rpx;

				.img {
					width: 100upx;
					height: 80upx;
					margin: 0 auto;
					margin-top: 25upx;
				}

				.img image {
					width: 100upx;
					height: 100upx;
				}

				.text {
					width: 100%;
					margin-top: 10upx;
					text-align: center;
					line-height: 2em;
				}
			}

			.grace-idcard-preview {
				margin-left: 30rpx;
				margin-top: 10rpx;

				image {
					width: 276rpx;
					height: 170rpx;
				}
			}

		}


		.grace-idcard-items3 {
			height: 300rpx;
			background: #FFFFFF;
			border-radius: 30upx;
			display: flex;
			align-items: center;
			justify-content: center;

			.grace-idcard-uper-btn {
				width: 276upx;
				background: #F1F1F1;
				border-radius: 10upx;
				text-align: center;
				margin-right: 10rpx;

				.img {
					width: 100upx;
					height: 80upx;
					margin: 0 auto;
					margin-top: 50upx;
				}

				.img image {
					width: 100upx;
					height: 100upx;
				}

				.text {
					width: 100%;
					margin-top: 10upx;
					text-align: center;
					line-height: 2em;
				}
			}

			.grace-idcard-preview {
				margin-left: 30rpx;
				margin-top: 10rpx;
				width: 276rpx;
				height: 200rpx;

				image {
					width: 100%;
					height: 100%;
				}
			}

		}
	}

	.opensubmit2 {
		height: 160rpx;
		padding: 20rpx;
		margin-top: 30rpx;
		border-radius: 30rpx;
		background-color: $bgcolor-white-0;

		.opensubmit_top {
			height: 80rpx;
			display: flex;
			flex-wrap: nowrap;
			align-items: center;

			.tongyi {}

			.tongname {
				color: $color-green-4;
			}
		}

		.opensubmit_bot {
			height: 80rpx;
			border-radius: 100rpx;
			background-color: $bgcolor-green-2;
			color: $color-white-0;
			font-size: $color-size-5;
			text-align: center;
			line-height: 80rpx;
		}
	}

	.opensubmit3 {
		height: 100rpx;
		width: calc(100% - 100rpx);
		padding: 20rpx;
		border-radius: 30rpx 30rpx 0rpx 0rpx;
		background-color: $bgcolor-white-0;
		display: flex;
		align-items: center;
		justify-content: space-between;
		position: fixed;
		bottom: 0rpx;
		left: 0rpx;
		right: 0rpx;
		margin: auto;

		.opensubmit_top {
			width: 40%;
			height: 80rpx;
			border-radius: 100rpx;
			background-color: $bgcolor-red-2;
			color: $color-white-0;
			font-size: $color-size-5;
			text-align: center;
			line-height: 80rpx;
		}

		.opensubmit_bot {
			width: 40%;
			height: 80rpx;
			border-radius: 100rpx;
			background-color: $bgcolor-green-2;
			color: $color-white-0;
			font-size: $color-size-5;
			text-align: center;
			line-height: 80rpx;
		}
	}



	.grace-idcard-main2 {
		margin: 20upx 30upx;

		.grace-idcard-text {
			line-height: 2em;
			margin-top: 30upx;
		}

		.grace-idcard-itemstop {
			background: #FFFFFF;
			border-radius: 30upx;
			padding: 20rpx;
		}

		.grace-idcard-items {
			background: #FFFFFF;
			border-radius: 30upx;
			padding: 30rpx;
			display: flex;
			align-items: center;
			justify-content: center;

			.grace-idcard-preview {
				margin-left: 30rpx;
				margin-top: 10rpx;

				image {
					width: 100%;
				}
			}

		}

		.auditfailurevalue {
			height: 300rpx;
			background: #FFFFFF;
			border-radius: 30upx;
			padding: 20rpx;
		}

		.grace-idcard-items3 {
			background: #fff;
			padding: 30rpx;
			border-radius: 30upx;
			display: flex;
			align-items: center;
			justify-content: center;

		}
	}


	.box {
		padding: 30rpx;
		background-color: #fff;

		.boxbox {
			height: 150rpx;

			.boxleft {
				height: 50rpx;
				line-height: 50rpx;
			}

			.boxright {
				height: 100rpx;
				line-height: 100rpx;
			}
		}
	}
</style>